The present invention relates to computer systems, and more particularly to a method and system for performing formatting asynchronously in a database system.
Conventional database management systems are used for a variety of applications. FIG. 1 depicts a portion of a computer system 10 on which the conventional database system operates. The computer system 10 is typically platform, such as a server. The computer system 10 a processor 12, includes a storage device, such as a disk 14, and an input/output device 16, such as a keyboard and display, which may be coupled to a workstation. In order to operate the conventional database system, a portion of the disk 14 is formatted to allow data input to the database system to be stored. This formatting is specific to the conventional database system desired to be used. In general, each conventional database system utilizes a particular format for storing and accessing data. The computer system 10 might support a variety of conventional database systems, as well as other applications. Thus, each time a particular conventional database system is to be used to store data, some portion of the disk 14 is formatted for that particular conventional database system. The formatting might include overwriting a portion of the disk as well as providing control information to allow the conventional database system to access the stored data. Typically, only a portion of the disk 14 is formatted because other applications might use remaining portions of the disk 14 to store data. Furthermore, formatting for a particular conventional database system is performed by the conventional database system only during operation of the conventional database system.
FIG. 2 depicts a conventional method 20 for formatting a storage device, such as the disk 14, for use by a conventional database system. Thus, the conventional method 20 may be considered to be part of and carried out by a conventional database system. The conventional method 20 is described in conjunction with the computer system 10. Referring to FIGS. 1 and 2, the conventional method 20 commences after a new file for the conventional database system is created. For example, the conventional method 20 may begin when a use opens a new table for storing data. A first element of the disk drive is formatted by the conventional database management system, via step 22. The size of the element in step 22 may depend upon the particular conventional database system. The actual formatting in step 22 may include using a mask to write a specific pattern in the element as well as providing control information, for example in a header. Input from and output to a user, as well as storage of data on the disk 14 are carried out, via step 24. It is determined whether data is to be stored such that the end of the current (first) increment is reached, via step 26. If not, then operation continues in step 24. However, if the end of the increment has been reached, then a new element is formatted for use by the conventional database system, via step 28. Any data that was to be stored but could not because the end of the first element was reached is then stored in the new element, via step 30. Thus, access to the disk 14 by the database system is stalled during formatting of the next increment in step 30. The method then returns to normal operations in step 24. The method 20 is typically repeated until the file for the database system is closed.
Thus, the conventional method 20 allows the conventional database system to format increments and store data on a storage device such as the disk 14, one of ordinary skill in the art will readily realize that the conventional method 20 results in delays to the user. The conventional method 20 formats a new increment only when a current increment is filled. Thus, if the data being stored would exceed space available in the current increment, then the storage operation is delayed until the subsequent increment is formatted. Once the subsequent increment is formatted, the data may be stored and operation can continue. For large amounts of data being stored, this delay may be significant, for example up to several seconds. Thus, the user becomes aware of a delay in inputting data to the conventional database system. This slowdown in performance of the conventional database management system is undesirable.
Accordingly, what is needed is a system and method for more efficiently formatting the storage device. The present invention addresses such a need.
The present invention provides a method and system for formatting space in a storage device for a database system. The method and system comprise formatting a first increment in the storage device for creating a database file and asynchronously formatting at least one subsequent increment in the storage device for the database file in a background of the database system.
According to the system and method disclosed herein, the present invention allows space on a disk to be formatted while allowing the user to experience reduced delays in processing input requests.